<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>偏好设置 | 全局来源设置</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect.
    -->
    <!-- zTree -->
    <link rel="stylesheet" href="../../plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="../../dist/css/communal.css">
    <style type="text/css" media="screen">
      .upload-btn{
        position: absolute;
        top: 0;left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        z-index: 1;
      }
    </style>
  </head>
  <body class="hold-transition skin-yellow sidebar-mini">
    <div class="wrapper">
      <!-- Main Header -->
      <header class="main-header">
        <!-- Logo -->
        <a href="../../index.html" class="logo">
          <!-- mini logo for sidebar mini 50x50 pixels -->
          <span class="logo-mini"><b>舆情</b></span>
          <!-- logo for regular state and mobile devices -->
          <span class="logo-lg"><b>舆情监测</b></span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
          <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
          </a>
          <!-- Navbar Right Menu -->
          <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
              <!-- Messages: style can be found in dropdown.less-->
              <li class="dropdown messages-menu">
                <!-- Menu toggle button -->
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <i class="fa fa-envelope-o"></i>
                  <span class="label label-success">4</span>
                </a>
                <ul class="dropdown-menu">
                  <li class="header">你有4条邮件！</li>
                  <li>
                    <!-- inner menu: contains the messages -->
                    <ul class="menu">
                      <li><!-- start message -->
                        <a href="#">
                          <div class="pull-left">
                            <!-- User Image -->
                            <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                          </div>
                          <!-- Message title and timestamp -->
                          <h4>
                            Support Team
                            <small><i class="fa fa-clock-o"></i> 5 mins</small>
                          </h4>
                          <!-- The message -->
                          <p>Why not buy a new awesome theme?</p>
                        </a>
                      </li><!-- end message -->
                    </ul><!-- /.menu -->
                  </li>
                  <li class="footer"><a href="#">See All Messages</a></li>
                </ul>
              </li><!-- /.messages-menu -->

              <!-- Notifications Menu -->
              <li class="dropdown notifications-menu">
                <!-- Menu toggle button -->
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <i class="fa fa-bell-o"></i>
                  <span class="label label-warning">10</span>
                </a>
                <ul class="dropdown-menu">
                  <li class="header">你有10条通知！</li>
                  <li>
                    <!-- Inner Menu: contains the notifications -->
                    <ul class="menu">
                      <li><!-- start notification -->
                        <a href="#">
                          <i class="fa fa-users text-aqua"></i> 5 new members joined today
                        </a>
                      </li><!-- end notification -->
                    </ul>
                  </li>
                  <li class="footer"><a href="#">View all</a></li>
                </ul>
              </li>
              <!-- Tasks Menu -->
              <li class="dropdown tasks-menu">
                <!-- Menu Toggle Button -->
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <i class="fa fa-flag-o"></i>
                  <span class="label label-danger">9</span>
                </a>
                <ul class="dropdown-menu">
                  <li class="header">你还有9个任务待完成！</li>
                  <li>
                    <!-- Inner menu: contains the tasks -->
                    <ul class="menu">
                      <li><!-- Task item -->
                        <a href="#">
                          <!-- Task title and progress text -->
                          <h3>
                            Design some buttons
                            <small class="pull-right">20%</small>
                          </h3>
                          <!-- The progress bar -->
                          <div class="progress xs">
                            <!-- Change the css width attribute to simulate progress -->
                            <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                              <span class="sr-only">20% Complete</span>
                            </div>
                          </div>
                        </a>
                      </li><!-- end task item -->
                    </ul>
                  </li>
                  <li class="footer">
                    <a href="#">View all tasks</a>
                  </li>
                </ul>
              </li>
              <!-- User Account Menu -->
              <li class="dropdown user user-menu">
                <!-- Menu Toggle Button -->
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <!-- The user image in the navbar-->
                  <img src="../../dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
                  <!-- hidden-xs hides the username on small devices so only the image appears. -->
                  <span class="hidden-xs">账户管理</span>
                </a>
                <ul class="dropdown-menu">
                  <!-- The user image in the menu -->
                  <li class="user-header">
                    <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                    <p>
                      张先森 - 男
                      <small>WEB 开发工程师</small>
                    </p>
                  </li>
                  <!-- Menu Body -->
                  <li class="user-body">
                    <div class="col-xs-4 text-center">
                      <a href="#">Followers</a>
                    </div>
                    <div class="col-xs-4 text-center">
                      <a href="#">Sales</a>
                    </div>
                    <div class="col-xs-4 text-center">
                      <a href="#">Friends</a>
                    </div>
                  </li>
                  <!-- Menu Footer-->
                  <li class="user-footer">
                    <div class="pull-left">
                      <a href="../../profile.html" class="btn btn-default btn-flat">个人中心</a>
                    </div>
                    <div class="pull-right">
                      <a href="#" class="btn btn-default btn-flat">退出账号</a>
                    </div>
                  </li>
                </ul>
              </li>
              <!-- Control Sidebar Toggle Button -->
              <li>
                <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
              </li>
            </ul>
          </div>
        </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <aside class="main-sidebar">
        <section class="sidebar">
          <div class="user-panel">
            <div class="pull-left image">
              <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
              <p>我的账户</p>
              <a href="#"><i class="fa fa-circle text-success"></i>在线</a>
            </div>
          </div>
          <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
              <input type="text" name="q" class="form-control" placeholder="Search...">
              <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>
              </span>
            </div>
          </form>
          <ul class="sidebar-menu">
            <!-- <li class="header">MAIN NAVIGATION</li> -->
            <li class="treeview">
              <a href="../../index.html">
                <i class="fa fa-home"></i> <span>总  览</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
            </li>
            <li class="treeview">
              <a href="../../index2.html">
                <i class="fa fa-area-chart"></i>
                <span>舆情监测</span>
                <!-- <span class="label label-primary pull-right">4</span> -->
                <i class="fa fa-angle-left pull-right"></i>
              </a>
            </li>
            <li class="treeview">
              <a href="#">
                <i class="fa fa-users"></i>
                <span>用户管理</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                <li><a href="../../custormer/app-custorm_mg.html"><i class="fa fa-circle-o"></i> app用户管理</a></li>
                <li><a href="../../custormer/web-custorm_mg.html"><i class="fa fa-circle-o"></i> web用管理户</a></li>
                <li><a href="../../custormer/roles.html"><i class="fa fa-circle-o"></i> 角色管理</a></li>
              </ul>
            </li>
            <li>
              <a href="../../fulltext_searching.html">
                <i class="fa fa-search-minus"></i> <span>全文搜素</span>
                <!-- <small class="label pull-right bg-red">3</small> -->
                <i class="fa fa-angle-left pull-right"></i>
              </a>
            </li>
            <li>
              <a href="#">
                <i class="fa fa-android"></i> <span>App管理</span>
                <i class="fa fa-angle-left pull-right"></i>
                <ul class="treeview-menu">
                  <li><a href="../../app_management/divisional.html"><i class="fa fa-circle-o"></i> 部门管理</a></li>
                  <li><a href="../../app_management/grouping.html"><i class="fa fa-circle-o"></i> 分组管理</a></li>
                </ul>
              </a>
            </li>
            <li class="treeview active">
              <a href="#">
                <i class="fa fa-gear"></i>
                <span>系统设置</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                <li>
                  <a href="#">
                    <i class="fa fa-calendar-minus-o"></i> 日志管理
                    <i class="fa fa-angle-left pull-right"></i>
                  </a>
                  <ul class="treeview-menu">
                    <li><a href="./customer_login_logs.html"><i class="fa fa-circle-o"></i> 用户登录日志</a></li>
                    <li><a href="./app_login_logs.html"><i class="fa fa-circle-o"></i> app用户登录日志</a></li>
                    <li><a href="./client_push_center.html"><i class="fa fa-circle-o"></i> 客户端push中心日志</a></li>
                    <li><a href="./client_push_logs.html"><i class="fa fa-circle-o"></i> 客户端推送日志</a></li>
                  </ul>
                </li>
                <li class="active">
                  <a href="#">
                    <i class="fa fa-laptop"></i> 偏好设置
                    <i class="fa fa-angle-left pull-right"></i>
                  </a>
                  <ul class="treeview-menu active">
                    <li class="active"><a href="./source_site_setting.html"><i class="fa fa-circle-o"></i> 来源网站设置</a></li>
                    <li><a href="./morris_conditions_setting.html"><i class="fa fa-circle-o"></i> 默认监测条件</a></li>
                  </ul>
                </li>
                <li><a href="../yj_setting.html"><i class="fa fa-circle-o"></i> 预警设置</a></li>
                <li><a href="../txl_setting.html"><i class="fa fa-circle-o"></i> 通讯录管理</a></li>
                <li><a href="../fsjl_setting.html"><i class="fa fa-circle-o"></i> 发送记录</a></li>
                <li><a href="../xzzq_setting.html"><i class="fa fa-circle-o"></i> 新增抓取</a></li>
              </ul>
            </li>
            <li class="treeview">
              <a href="../../profile.html">
                <i class="fa fa-user"></i> <span>个人中心</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
            </li>
          </ul>
        </section>
        <!-- /.sidebar -->
      </aside>
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>全局来源设置</h1>
          <ol class="breadcrumb">
            <li><a href="../txl_setting.html"><i class="fa fa-file-text-o"></i>偏好设置</a></li>
            <li class="active">全局来源设置</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="box box-info">
            <div class="box-header">
              <h3 class="box-title">全局来源设置</h3>
              <div class="box-tools">
                <button type="button" data-target="#addSourceSiteModal" data-toggle="modal" class="btn btn-sm btn-warning">
                  <i class="fa fa-plus"></i>新增
                </button>
                <a href="#" class="btn btn-sm btn-warning" style="position: relative;">
                  <i class="fa fa-upload"></i>上传
                  <input type="file" class="upload-btn"></input>
                </a>
              </div>
            </div><!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover text-center">
                <tr>
                  <th width="45%" class="text-center">来源名称</th>
                  <th width="15%" class="text-center">来源数</th>
                  <th width="15%" class="text-center">开关</th>
                  <th width="25%" class="text-center">操作</th>
                </tr>
                <tr>
                  <td>来源名称</td>
                  <td>来源名称</td>
                  <td>开关</td>
                  <td>
                    <a href="#" class="btn btn-xs btn-info">查看</a>
                    <button type="button" data-toggle="modal" data-target="#editSourceSiteModal" class="btn btn-xs btn-warning">修改</button>
                    <button type="button" data-toggle="modal" data-target="#deleteModal" class="btn btn-xs btn-danger">删除</button>
                  </td>
                </tr>
                <tr>
                    <td>来源名称</td>
                    <td>来源名称</td>
                    <td>开关</td>
                    <td>
                      <a href="#" class="btn btn-xs btn-info">查看</a>
                      <a href="#" class="btn btn-xs btn-warning">修改</a>
                      <button type="button" data-toggle="modal" data-target="#deleteModal" class="btn btn-xs btn-danger">删除</button>
                    </td>
                  </tr>
              </table>
            </div>
            <div class="box-footer clearfix">
              <ul class="pagination pagination-sm no-margin pull-right">
                <!-- <li><a href="#">&laquo;</a></li> -->
                <li class="disabled"><a href="#">首页</a></li>
                <li class="disabled"><a href="#">上一页</a></li>
                <li class="active"><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <!-- <li><a href="#">&raquo;</a></li> -->
                <li><a href="#">下一页</a></li>
              </ul>
            </div>
          </div>
        </section>
      </div>

      <!-- Main Footer -->
      <footer class="main-footer">
        <!-- To the right -->
        <div class="pull-right hidden-xs">
          Anything you want
        </div>
        <!-- Default to the left -->
        <strong>Copyright &copy; 2015 <a href="#">Company</a>.</strong> All rights reserved.
      </footer>

      <!-- Control Sidebar -->
      <aside class="control-sidebar control-sidebar-dark">
        <!-- Create the tabs -->
        <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
          <li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
          <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content">
          <!-- Home tab content -->
          <div class="tab-pane active" id="control-sidebar-home-tab">
            <h3 class="control-sidebar-heading">Recent Activity</h3>
            <ul class="control-sidebar-menu">
              <li>
                <a href="javascript::;">
                  <i class="menu-icon fa fa-birthday-cake bg-red"></i>
                  <div class="menu-info">
                    <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
                    <p>Will be 23 on April 24th</p>
                  </div>
                </a>
              </li>
            </ul><!-- /.control-sidebar-menu -->

            <h3 class="control-sidebar-heading">Tasks Progress</h3>
            <ul class="control-sidebar-menu">
              <li>
                <a href="javascript::;">
                  <h4 class="control-sidebar-subheading">
                    Custom Template Design
                    <span class="label label-danger pull-right">70%</span>
                  </h4>
                  <div class="progress progress-xxs">
                    <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
                  </div>
                </a>
              </li>
            </ul><!-- /.control-sidebar-menu -->

          </div><!-- /.tab-pane -->
          <!-- Stats tab content -->
          <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div><!-- /.tab-pane -->
          <!-- Settings tab content -->
          <div class="tab-pane" id="control-sidebar-settings-tab">
            <form method="post">
              <h3 class="control-sidebar-heading">General Settings</h3>
              <div class="form-group">
                <label class="control-sidebar-subheading">
                  Report panel usage
                  <input type="checkbox" class="pull-right" checked>
                </label>
                <p>
                  Some information about this general settings option
                </p>
              </div><!-- /.form-group -->
            </form>
          </div><!-- /.tab-pane -->
        </div>
      </aside><!-- /.control-sidebar -->
      <!-- Add the sidebar's background. This div must be placed
           immediately after the control sidebar -->
      <div class="control-sidebar-bg"></div>
    </div><!-- ./wrapper -->
    
    <div class="example-modal">
      <!-- 新增来源设置 -->
      <div class="modal modal-default fade" id="addSourceSiteModal">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close close-modal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title">选择要加入监测的网站</h4>
            </div>
            <div class="modal-body">
              <div class="row">
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <span style="color: red;">*</span>
                      来源名称：
                    </div>
                    <div class="form-group">
                      <input type="text" class="form-control">
                    </div>
                  </form>
                </div>
                <div class="col-sm-6"></div>
              </div>
              <div class="row" style="margin: 15px 0;">
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <input type="text" class="form-control" placeholder="输入网站名称查询">
                    </div>
                    <div class="form-group">
                      <button type="button" class="btn btn-warning">搜索</button>
                    </div>
                  </form>
                </div>
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <input type="text" class="form-control" placeholder="输入网站名称或域名联想">
                    </div>
                  </form>
                </div>
              </div>
              <!-- 多选穿梭框 -->
              <div class="box">
                <div class="box-body">
                    <div class="row">
                      <div class="col-sm-6">
                        <p style="color: red;">*定向监测最多可支持300个来源站点</p>
                      </div>
                      <div class="col-sm-6">
                        <p style="color: red;">*已选<b id="LEN">0</b> 个</p>
                      </div>
                    </div>
                  <div class="row">
                    <div class="col-sm-5" style="">
                      <div style="min-height: 300px;border: 1px solid #bfbfbf;overflow-y: scroll;">
                        <ul id="treeDemo" class="ztree"></ul>
                      </div>
                    </div>
                    <div class="col-sm-2" style="position: relative;min-height: 300px;">
                        <div style="position:absolute;top: 50%;left: 50%;margin-top: -40px;margin-left: -34px;line-height: 40px;">
                            <button id="add" type="button" class="btn btn-warning">增加&gt;</button>
                            <button id="del" type="button" class="btn btn-default">&lt;删除</button>
                        </div>
                    </div>
                    <div class="col-sm-5" style="">
                        <div style="min-height: 300px;border: 1px solid #bfbfbf;overflow-y: scroll;">
                          <ul id="treeCont" class="ztree"></ul>
                        </div>
                      </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal-footer text-center empty-tree">
              <button type="button" class="yes btn btn-primary">确定</button>
              <button type="button" class="no btn btn-default" data-dismiss="modal">取消</button>
            </div>
          </div>
        </div>
      </div><!-- /. 新增来源设置 -->
      <!-- 修改来源设置 -->
      <div class="modal modal-default fade" id="editSourceSiteModal">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close close-modal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title">选择要加入监测的网站</h4>
            </div>
            <div class="modal-body">
              <div class="row">
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <span style="color: red;">*</span>
                      来源名称：
                    </div>
                    <div class="form-group">
                      <input type="text" class="form-control">
                    </div>
                  </form>
                </div>
                <div class="col-sm-6"></div>
              </div>
              <div class="row" style="margin: 15px 0;">
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <input type="text" class="form-control" placeholder="输入网站名称查询">
                    </div>
                    <div class="form-group">
                      <button type="button" class="btn btn-warning">搜索</button>
                    </div>
                  </form>
                </div>
                <div class="col-sm-6">
                  <form action="" class="form-inline">
                    <div class="form-group">
                      <input type="text" class="form-control" placeholder="输入网站名称或域名联想">
                    </div>
                  </form>
                </div>
              </div>
              <!-- 多选穿梭框 -->
              <div class="box">
                <div class="box-body">
                    <div class="row">
                      <div class="col-sm-6">
                        <p style="color: red;">*定向监测最多可支持300个来源站点</p>
                      </div>
                      <div class="col-sm-6">
                        <p style="color: red;">*已选<b id="LEN">0</b> 个</p>
                      </div>
                    </div>
                  <div class="row">
                    <div class="col-sm-5" style="">
                      <div style="min-height: 300px;border: 1px solid #bfbfbf;overflow-y: scroll;">
                        <ul id="treeDemo2" class="ztree"></ul>
                      </div>
                    </div>
                    <div class="col-sm-2" style="position: relative;min-height: 300px;">
                        <div style="position:absolute;top: 50%;left: 50%;margin-top: -40px;margin-left: -34px;line-height: 40px;">
                            <button id="add2" type="button" class="btn btn-warning">增加&gt;</button>
                            <button id="del2" type="button" class="btn btn-default">&lt;删除</button>
                        </div>
                    </div>
                    <div class="col-sm-5" style="">
                        <div style="min-height: 300px;border: 1px solid #bfbfbf;overflow-y: scroll;">
                          <ul id="treeCont2" class="ztree"></ul>
                        </div>
                      </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal-footer text-center empty-tree2">
              <button type="button" class="yes btn btn-primary">确定</button>
              <button type="button" class="no btn btn-default" data-dismiss="modal">取消</button>
            </div>
          </div>
        </div>
      </div><!-- /. 修改来源设置 -->
      <!-- 删除确认 -->
      <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header" style="color: #fff;background: #f39c12;">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title" id="myModalLabel3">删除信息</h4>
            </div>
            <div class="modal-body">
              <div class="text-center">
                  请选择需要删除的信息？
              </div>
            </div>
            <div class="modal-footer">
              <div class="text-center">
                  <button type="button" class="btn btn-success" data-dismiss="modal">确定</button>
                  <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
              </div>
            </div>
          </div>
        </div>
      </div><!-- /.删除确认 -->
    </div>
    

    <!-- jQuery 2.1.4 -->
    <script src="../../plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- <script src="../../dist/js/jquery.multi-select.js"></script> -->
    <!-- Bootstrap 3.3.5 -->
    <script src="../../bootstrap/js/bootstrap.min.js"></script>
    <!-- AdminLTE App -->
    <script src="../../dist/js/app.min.js"></script>
    <!-- Tree Sampledata -->
    <script src="../../plugins/doublebox-bootstrap/doublebox-bootstrap.js"></script>
    <script type="text/javascript" src="../../plugins/zTree_v3/js/jquery.ztree.core.min.js"></script>
    <script type="text/javascript" src="../../plugins/zTree_v3/js/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" .src="../../plugins/zTree_v3/js/jquery.ztree.excheck.min.js"></script>

    <script type="text/javascript">
      // 新增
      $(function () {
        $(document).ready(function(){
          var setting = {
            view: {
              dblClickExpand: false
            },
            check: {
              enable: true
            },
            callback: {
              onCheck:onCheck
            }
          };
          var setting_r = {
            view: {
              dblClickExpand: false
            },
            callback: {
              onClick:onClick
            }
          };
          var zNodes =[{
              id:1, 
              name:"全部", 
              pId:0,
              open:true, 
              noR:true,
              children:[
                {
                  id:11, 
                  pId: 1,
                  name:"北京", 
                  noR:true,
                  children: [
                    {
                      id:111, 
                      pId: 11,
                      name:"网站", 
                      noR:true
                    },{
                      id:112, 
                      pId: 11,
                      name:"报刊", 
                      noR:true
                    },{
                      id:113, 
                      pId: 11,
                      name:"论坛", 
                      noR:true
                    },{
                      id:114, 
                      pId: 11,
                      name:"博客", 
                      noR:true
                    },{
                      id:115, 
                      pId: 11,
                      name:"贴吧", 
                      noR:true
                    }
                  ]
                },{
                  id:12, 
                  name:"天津",
                  pId: 1,
                  noR:true,
                  children: [
                    {
                      id:121, 
                      pId: 12,
                      name:"网站", 
                      noR:true
                    },{
                      id:123, 
                      pId: 12,
                      name:"报刊", 
                      noR:true
                    },{
                      id:124, 
                      pId: 12,
                      name:"论坛", 
                      noR:true
                    }
                  ]
                }
              ]}
            ];

          var rightZNodes = [];
          var deletedNodes = [], filtrateNodes = [];
          function onCheck(e,treeId,treeNode){
            var treeObj=$.fn.zTree.getZTreeObj("treeDemo"), nodes=treeObj.getCheckedNodes(true), v="";

            rightZNodes = nodes;
            deletedNodes = nodes;
            $('#LEN').html(nodes.length);
          }
          // 左侧树形结构  -- init()
          $.fn.zTree.init($("#treeDemo"), setting, zNodes);

          // 删除
          function onClick(event, treeId, treeNode){
            // 要删除的数据
            console.log(deletedNodes)
            var result = [];

            deletedNodes.forEach(function(element){
              if(element.id !== treeNode.id){
                result.push(element)
              }
            })
            filtrateNodes = result;
          };

          // 处理已选中的数据
          function findChildren(list, pid) {
            var arrs = [];
            var k = 0;
            for(var i = 0; i < list.length; i++) {
              if (list[i].pId == pid) {
                list[i].children = findChildren(list, list[i].id);
                arrs[k] = list[i];
                ++k;
              }
            }
            return arrs.length == 0 ? null : arrs;
          }
          // 增加
          $('#add').on('click', function(){
            var result = null;
            for(var i = 0; i < rightZNodes.length; i++) {
              var pid = rightZNodes[i].pId;
              if (pid == 0) {
                result = rightZNodes[i];  // 父级
                result.children = findChildren(rightZNodes, rightZNodes[i].id);

                $.fn.zTree.init($("#treeDemo"), setting, zNodes);
                break;
              }
            }
            // console.log(result);
            $.fn.zTree.init($("#treeCont"), setting_r, result);
            rightZNodes = [];
          })
          
          // 删除
          $('#del').click(function(){
            toDelete();
            deletedNodes = filtrateNodes;
          })
          function toDelete(){
            var result = null;
            for(var i = 0; i < filtrateNodes.length; i++) {
              var pid = filtrateNodes[i].pId;
              if (pid == 0) {
                result = filtrateNodes[i];  // 父级
                result.children = findChildren(filtrateNodes, filtrateNodes[i].id);

                $.fn.zTree.init($("#treeCont"), setting_r, result);
                break;
              }
            }

            $.fn.zTree.init($("#treeCont"), setting_r, result);
          }

          // 关闭弹出层 并清空数据
          $('#addSourceSiteModal .close-modal,#addSourceSiteModal button.no').on('click', function(){
            $('#treeCont').empty();
          })
        })
      })
      // 修改
      $(function () {
        $(document).ready(function(){
          var setting = {
            view: {
              dblClickExpand: false
            },
            check: {
              enable: true
            },
            callback: {
              onCheck:onCheck
            }
          };
          var setting_r = {
            view: {
              dblClickExpand: false
            },
            callback: {
              onClick:onClick
            }
          };
          var zNodes =[{
              id:1, 
              name:"全部", 
              pId:0,
              open:true, 
              noR:true,
              children:[
                {
                  id:11, 
                  pId: 1,
                  name:"北京", 
                  noR:true,
                  children: [
                    {
                      id:111, 
                      pId: 11,
                      name:"网站", 
                      noR:true
                    },{
                      id:112, 
                      pId: 11,
                      name:"报刊", 
                      noR:true
                    },{
                      id:113, 
                      pId: 11,
                      name:"论坛", 
                      noR:true
                    },{
                      id:114, 
                      pId: 11,
                      name:"博客", 
                      noR:true
                    },{
                      id:115, 
                      pId: 11,
                      name:"贴吧", 
                      noR:true
                    }
                  ]
                },{
                  id:12, 
                  name:"天津",
                  pId: 1,
                  noR:true,
                  children: [
                    {
                      id:121, 
                      pId: 12,
                      name:"网站", 
                      noR:true
                    },{
                      id:123, 
                      pId: 12,
                      name:"报刊", 
                      noR:true
                    },{
                      id:124, 
                      pId: 12,
                      name:"论坛", 
                      noR:true
                    }
                  ]
                }
              ]}
            ];

          var rightZNodes = [];
          var deletedNodes = [], filtrateNodes = [];
          function onCheck(e,treeId,treeNode){
            var treeObj=$.fn.zTree.getZTreeObj("treeDemo2"), nodes=treeObj.getCheckedNodes(true), v="";

            rightZNodes = nodes;
            deletedNodes = nodes;
            $('#LEN').html(nodes.length);
          }
          // 左侧树形结构  -- init()
          $.fn.zTree.init($("#treeDemo2"), setting, zNodes);

          // 删除
          function onClick(event, treeId, treeNode){
            // 要删除的数据
            console.log(deletedNodes)
            var result = [];

            deletedNodes.forEach(function(element){
              if(element.id !== treeNode.id){
                result.push(element)
              }
            })
            filtrateNodes = result;
          };

          // 处理已选中的数据
          function findChildren(list, pid) {
            var arrs = [];
            var k = 0;
            for(var i = 0; i < list.length; i++) {
              if (list[i].pId == pid) {
                list[i].children = findChildren(list, list[i].id);
                arrs[k] = list[i];
                ++k;
              }
            }
            return arrs.length == 0 ? null : arrs;
          }
          // 增加
          $('#add2').on('click', function(){
            var result = null;
            for(var i = 0; i < rightZNodes.length; i++) {
              var pid = rightZNodes[i].pId;
              if (pid == 0) {
                result = rightZNodes[i];  // 父级
                result.children = findChildren(rightZNodes, rightZNodes[i].id);

                $.fn.zTree.init($("#treeDemo2"), setting, zNodes);
                break;
              }
            }
            // console.log(result);
            $.fn.zTree.init($("#treeCont2"), setting_r, result);
            rightZNodes = [];
          })
          
          // 删除
          $('#del2').click(function(){
            toDelete();
            deletedNodes = filtrateNodes;
          })
          function toDelete(){
            var result = null;
            for(var i = 0; i < filtrateNodes.length; i++) {
              var pid = filtrateNodes[i].pId;
              if (pid == 0) {
                result = filtrateNodes[i];  // 父级
                result.children = findChildren(filtrateNodes, filtrateNodes[i].id);

                $.fn.zTree.init($("#treeCont2"), setting_r, result);
                break;
              }
            }

            $.fn.zTree.init($("#treeCont2"), setting_r, result);
          }
          // 关闭弹出层 并清空数据
          $('#editSourceSiteModal .close-modal,#editSourceSiteModal button.no').on('click', function(){
            $('#treeCont2').empty();
          })
        })
      })
    </script>
  </body>
</html>
